<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>

<%@page import="com.lovo.bbs.vo.*,com.lovo.bbs.bo.*,java.util.*"%>

<%
	String aslinkid = request.getParameter("linkid");
	int linkid = 0;
	if (!"".equals(aslinkid) && aslinkid != null) {
		linkid = Integer.parseInt(aslinkid);
	}
	LinkVo forumlinkData = new LinkBo().getLinkByID(linkid);
	if (linkid == 0) {
		forumlinkData.setAboutLink("");
		forumlinkData.setLinkname("");
		forumlinkData.setLinkurl("");
	}

	String queryPage = (String) request.getParameter("queryPage");

	String asOpType = (String) request.getParameter("opType");
	int opType = 1;
	if (!"".equals(asOpType) && asOpType != null) {
		opType = Integer.parseInt(asOpType);
	}

	String[] processMod = { "增加友情链接", "修改友情链接", "删除友情链接" };
%>
<html>
	<head>
		<link href="../../../css/admin.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../../../js/wbs_admin.js"></script>
		<script type="text/javascript">
		 function validate(){
       	   var msg=document.getElementById("errormsg");
       	   if(trim(document.frmMain.linkname.value)==""){            
              msg.innerHTML="<br><font color='red'>提示:请输入友情链接名称</font>"    
              document.frmMain.linkname.focus();
              return false;
           }
           
           if(!isUrl(document.frmMain.url.value)){            
              msg.innerHTML="<br><font color='red'>提示:请正确输入链接URL地址</font>"    
              document.frmMain.url.focus();
              return false;
           }
       	   
       	   if(trim(document.frmMain.reads.value)==""){            
              msg.innerHTML="<br><font color='red'>提示:请输入链接简单说明</font>"    
              document.frmMain.reads.focus();
              return false;
           }
           
           if(document.frmMain.reads.value.length>300){            
              msg.innerHTML="<br><font color='red'>提示:输入链接简单说明内容过长</font>"    
              document.frmMain.reads.focus();
              return false;
           }
		  return true;  
        }
		</script>
	</head>
	<body>
		<form name="frmMain" action="LinkUpdateServlet" method="post"
			onSubmit="return validate();">
			<table class="navigation" style="width: 98%" align="center">
				<tr>
					<td>
						当前位置: 论坛管理-->操作-->
						<font color="red"><%=processMod[opType - 1]%></font>
					</td>
				</tr>
			</table>
			<br>
			<table style="width: 90%;" align="center">
				<div class="DialogBody">
					<div class="formArea">
						<div id="errormsg" class="DialogMsg"></div>
						<p>
							友情链接名称:
							<input type="text" name="linkname" style="width: 200px"
								maxlength="100" value="<%=forumlinkData.getLinkname()%>">
							(提示:超链接的名称,1~100字符)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

						
						<p>
							URL链接地址:
							<input type="text" name="url" style="width: 200px"
								maxlength="100" value="<%=forumlinkData.getLinkurl()%>">
							(提示:超链接的URL地址,1~100字符)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
						<p>
							链接说明:(友情链接的简单说明,1~300字符)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<br>
							<textarea name="reads" wrap=soft rows=8 cols=55><%=forumlinkData.getAboutLink()%></textarea>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

						
						<p>
							<input type="submit" name="submit" class="button" value=" 确定 "
								onclick="validate();">
							<input type="button" name="button" class="button" value=" 取消 "
								onclick="preReturn();">
						<p>
							<br>
					</div>
				</div>
			</table>
			
			<input type="hidden" name="linkid"
				value="<%=forumlinkData.getLinkid()%>">

			<input type="hidden" name="opType" value="<%=opType%>">

			<input type="hidden" name="queryPage" value="<%=queryPage%>">

		</form>
	</body>
</html>
